﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace DoctorWorld
{
    class Writer
    {
        private String dirFile;

        public Writer(String dirFile)
        {
            this.dirFile = dirFile;
        }

        public void BuildFile(List<String> listaDeAtributos)
        {
            StreamWriter file;
            try 
            {
                file = File.CreateText(this.dirFile);
            } catch (Exception e)
            {
                throw new FileCreationException();
            }

            for (int i = 0 ; i < listaDeAtributos.Count - 1 ; i++)
                file.WriteLine(listaDeAtributos.ElementAt(i));

            file.Write(listaDeAtributos.ElementAt(listaDeAtributos.Count - 1));

            file.Close();
        }
    }
}
